package com.study.ui.test.test_listadapter

import com.lbj.core.ext.runWork
import com.study.R
import com.study.app.app.BaseActivity
import com.study.databinding.ActivityTestListAdapterBinding

class TestListAdapterActivity : BaseActivity<TestListAdapterVM, ActivityTestListAdapterBinding>() {

    override fun layoutId() = R.layout.activity_test_list_adapter

    private val adapter by lazy { TestListAptAdapter() }

    override fun initView() {
        VM.getProductList()
        VM.productListMLD.observe(this) { work ->
            runWork(work, {
                VM.list.addAll(it.list)
                adapter.submitList(ArrayList(VM.list))
            }, {})
        }
    }

    override fun bind() {
        binding.adapter = adapter
    }
}